<style lang="less" scoped src="./teacherinfo.less"></style>
<script src="./teacherinfo.js"></script>
<template>
    <div>
        <Row style="font-size: 15px;">
            <Col span="24">
                姓名：<Input v-model="query.name" clearable style="width: 15%"></Input>
                性别：
                <Select v-model="query.gender" style="width:15%" filterable clearable>
                    <Option v-for="item in sexList" :value="item.id" :key="item.id">{{item.name}}</Option>
                </Select>
                学历：
                <Select v-model="query.educationid" style="width:15%" filterable clearable>
                    <Option v-for="item in learnList" :value="item.id" :key="item.id">{{item.name}}</Option>
                </Select>
                教师类型：
                <Select v-model="query.teachertypeid" style="width:15%" filterable clearable>
                    <Option v-for="item in teachertypeList" :value="item.id" :key="item.id">{{item.name}}</Option>
                </Select>
            </Col>
        </Row>
        <Row style="font-size: 15px;;margin-top: 5px">
            <Col span="22">
                <span @click="loadList"><Button type="primary" icon="android-search">查询</Button></span>
                <span @click="refresh"><Button type="primary" icon="refresh">清空</Button></span>
            </Col>
            <Col span="2">
                <span @click="showAdd"><Button type="primary" icon="android-add">新增</Button></span>
            </Col>
        </Row>
        <div class="main-table">
            <Table border :columns="columns" :data="data"></Table>
        </div>
        <div class="pagination">
            <Page :total="total" size="small" :page-size="pageSize" :current.sync="pageIndex" @on-change="loadList"
                  show-total show-elevator></Page>
        </div>
        <Modal
                v-model="editModal"
                :title="(isRead ? '查看' : (formData.id ? '修改': '新增')) + '教师'"
                okText="保存"
                cancelText="关闭"
                @on-change="editModal = false"
                @on-ok="save"
                :loading="load"
                :mask-closable="isRead"
                :closable="isRead"
                width="70%">
            <Form :label-width="80" :model="formData" :rules="formDataRules" ref="formData">
                <Row >
                    <Col span="12">
                        <FormItem label="姓名:" prop="name" >
                            <Input type="text" v-model="formData.name"></Input>
                        </FormItem>
                    </Col>
                    <Col span="12">
                        <FormItem label="手机:" prop="cellphone">
                            <Input type="text" v-model="formData.cellphone"></Input>
                        </FormItem>
                    </Col>
                </Row>
                <Row >
                    <Col span="12">
                        <FormItem label="身份证号:" prop="cardId">
                            <Input type="text" v-model="formData.cardId"></Input>
                        </FormItem>
                    </Col>
                    <Col span="12">
                        <FormItem label="任职部门:" prop="orgname">
                            <Input  :readonly="true" :icon="isRead ? '': 'search'" v-model="formData.orgname"  @on-click="orgModal=true"></Input>
                        </FormItem>
                    </Col>
                </Row>
                <Row >
                    <Col span="12">
                        <FormItem label="学历:">
                            <Select v-model="formData.educationid">
                                <Option v-for="item in learnList" :value="item.id" :key="item.id">{{item.name}}
                                </Option>
                            </Select>
                        </FormItem>
                    </Col>
                    <Col span="12">
                        <FormItem label="职称:">
                            <Select v-model="formData.technicalid">
                                <Option v-for="item in positionList" :value="item.id" :key="item.id">{{item.name}}
                                </Option>
                            </Select>
                        </FormItem>
                    </Col>

                </Row>
                <Row >
                    <Col span="12">
                        <FormItem label="教师类型:" prop="teachertypeid">
                            <Select v-model="formData.teachertypeid" :clearable="!isRead" :disabled="isRead">
                                <Option v-for="item in teachertypeList" :value="item.id" :key="item.id">{{item.name}}</Option>
                            </Select>
                        </FormItem>
                    </Col>
                    <!--<Col span="4" class="titele"><span style="color: red">*</span>专业：</Col>
                    <Col span="8" class="content">
                    <Input  :readonly="true" :icon="isRead ? '': 'search'" v-model="formData.majorsname"  @on-click="initMajorTree()"></Input>
                    </Col>-->
                    <Col span="12">
                        <FormItem label="专业:" prop="majorsname">
                            <Input  :readonly="true" :icon="isRead ? '': 'search'" v-model="formData.majorsname"  @on-click="initMajorTree()"></Input>
                        </FormItem>
                    </Col>
                </Row>
                <Row >
                    <!--<Col span="4" class="titele">出生日期：</Col>
                    <Col span="8" class="content">
                    <DatePicker v-model="formData.birthday" :clearable="!isRead" :readonly="isRead" :editable="false" style="width: 100%"></DatePicker>
                    </Col>
                    <Col span="4" class="titele">从教日期：</Col>
                    <Col span="8" class="content">
                    <DatePicker v-model="formData.teachtime" :clearable="!isRead" :readonly="isRead" :editable="false" style="width: 100%"></DatePicker>
                    </Col>-->
                    <Col span="12">
                        <FormItem label="出生日期:" prop="birthday">
                            <DatePicker v-model="formData.birthday" :clearable="!isRead" :readonly="isRead" :editable="false" style="width: 100%"></DatePicker>
                        </FormItem>
                    </Col>
                    <Col span="12">
                        <FormItem label="从教日期:" prop="teachtime">
                            <DatePicker v-model="formData.teachtime" :clearable="!isRead" :readonly="isRead" :editable="false" style="width: 100%"></DatePicker>
                        </FormItem>
                    </Col>
                </Row>
                <Row >
                    <!--   <Col span="4" class="titele">性别：</Col>
                       <Col span="8" class="content">
                       <Select v-model="formData.gender" :clearable="!isRead" :disabled="isRead">
                           <Option v-for="item in sexList" :value="item.id" :key="item.id">{{item.name}}</Option>
                       </Select>
                       </Col>-->
                    <Col span="12">
                        <FormItem label="性别:"  prop="gender">
                            <Select v-model="formData.gender" :clearable="!isRead" :disabled="isRead">
                                <Option v-for="item in sexList" :value="item.id" :key="item.id">{{item.name}}</Option>
                            </Select>
                        </FormItem>
                    </Col>
                    <!--  <Col span="4" class="titele">邮箱：</Col>
                      <Col span="8" class="content">
                      <Input v-model="formData.emial" :readonly="isRead" ></Input>
                      </Col>-->
                    <Col span="12">
                        <FormItem label="邮箱:" prop="emial">
                            <Input v-model="formData.emial" :readonly="isRead" ></Input>
                        </FormItem>
                    </Col>
                </Row>
                <Row >
                    <!--<Col span="4" class="titele">家庭电话：</Col>
                    <Col span="8" class="content">
                    <Input v-model="formData.homeTelephone" :readonly="isRead" ></Input>
                    </Col>
                    <Col span="4" class="titele">单位电话：</Col>
                    <Col span="8" class="content">
                    <Input v-model="formData.workTelephone" :readonly="isRead"></Input>
                    </Col>-->
                    <Col span="12">
                        <FormItem label="家庭电话:" prop="homeTelephone">
                            <Input v-model="formData.homeTelephone" :readonly="isRead" ></Input>
                        </FormItem>
                    </Col>
                    <Col span="12">
                        <FormItem label="单位电话:" prop="workTelephone">
                            <Input v-model="formData.workTelephone" :readonly="isRead"></Input>
                        </FormItem>
                    </Col>
                </Row>
                <!-- <Row >
                     <Col span="4" class="titele">信用卡名称：</Col>
                     <Col span="8" class="content">
                     <Input v-model="formData.creditname" :readonly="isRead" ></Input>
                     </Col>
                     <Col span="4" class="titele">信用卡号：</Col>
                     <Col span="8" class="content">
                     <Input v-model="formData.creditno" :readonly="isRead" ></Input>
                     </Col>
                 </Row>-->
                <Row >
                    <!--<Col span="4" class="titele">家庭地址：</Col>
                    <Col span="8" class="content">
                    <Input type="textarea" v-model="formData.address" :readonly="isRead" ></Input>
                    </Col>-->
                    <Col span="12">
                        <FormItem label="家庭地址:">
                            <Input type="textarea" v-model="formData.address" :readonly="isRead" ></Input>
                        </FormItem>
                    </Col>
                    <Col span="12">
                        <FormItem label="教师简介:">
                            <Input type="textarea" v-model="formData.intro" :readonly="isRead" ></Input>
                        </FormItem>
                    </Col>
                    <!--<Col span="4" class="titele">教师简介：</Col>
                    <Col span="8" class="content">
                    <Input type="textarea" v-model="formData.intro" :readonly="isRead" ></Input>
                    </Col>-->
                </Row>
            </Form>
            <div slot="footer" v-if="!isRead">
                <Button type="primary" :loading="load" @click="save" >保存</Button>
                <Button type="ghost" style="margin-left: 8px" @click="editModal = false">取消</Button>
            </div>
        </Modal>

        <Modal  v-model="orgModal"
                @on-ok="getPermission"
                width="20%">
            <div>
                <Tree ref="treeOrg" :data="orgTree"  ></Tree>
            </div>
        </Modal>
        <Modal  v-model="mojorModal"
                @on-ok="getPermissions"
                width="20%">
            <div style="height: 350px;overflow-y: scroll">
                <Tree ref="tree" :data="majorTree" expand="true"  show-checkbox></Tree>
            </div>
        </Modal>
    </div>
</template>
